<%--
  Created by IntelliJ IDEA.
  User: Zach Huffman
  Date: 4/14/13
  Time: 11:21 PM
  To change this template use File | Settings | File Templates.
--%>

<%@ page import="gfo.Bracket; gfo.Tournament; gfo.Player" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="Match" />
        <title>${player1.fullName} v ${player2.fullName}</title>
    </head>
    <body>
        <div class="body">
            <g:set var="record1by2" value="${player1.calcWinsByOppPlayer(player2)}"></g:set>
            <table class="pvp">
                <tbody>
                <tr><!--players-->
                    <td><h2>${player1.fullName}</h2></td>
                    <td> v </td>
                    <td><h2>${player2.fullName}</h2></td>
                </tr>
                
                <tr><!--wins-->
                    <td>${record1by2[0]}</td>
                    <td class="ctext">Wins</td>
                    <td>${record1by2[1]}</td>
                </tr>

                <tr><!--totalMatches-->
                    <td></td>
                    <td class="outOf">Out of</td>
                    <td></td>
                </tr>
                
                <tr><!--total-->
                    <td></td>
                    <td>${record1by2[2]}</td>
                    <td></td>
                </tr>

                <tr><!--best with-->
                    <td>${player1.strongestFighter()}</td>
                    <td class="ctext">Best with</td>
                    <td>${player2.strongestFighter()}</td>
                </tr>

                <tr><!--counter-->
                <g:set var="counter1" value="${player1.counterPlayerAndFighter(player2,player2.strongestFighter())}"></g:set>
                <g:set var="counter2" value="${player2.counterPlayerAndFighter(player1,player1.strongestFighter())}"></g:set>
                    <td>${counter1? counter1 : 'NA'}</td>
                    <td class="ctext">Counter</td>
                    <td>${counter2? counter2 : 'NA'}</td>
                </tr>
                </tbody>
            </table>
            <h1></h1>
            <h2>Matches
            </h2>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <ul>
                <g:each in="${matches}" var="match">
                    <li><g:link action="show" id="${match.id}">${match.encodeAsHTML()}</g:link></li>
                </g:each>
            </ul>
</body>
</html>